home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
regnpckg.sit
/
Picture MDEF ƒ
/
menu demo.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-10
|
1KB
|
59 lines
/* A VERY simple demo of the Picture MDEF for programmers.
Picture MDEF ⌐ 1990, Nigel Perry
Free for personal use and in stacks & applications which are free.
May not be used for commercial or profit-making purposes or in
ShareWare without permission.
Nigel Perry (np@doc.ic.ac.uk), Dec 90.
*/
#include <stdio.h>
#include <asm.h>
#include "PicMDEF.h"
main()
{ MenuHandle mh;
PicHandle ph;
nrctHand nh;
EventRecord event;
WindowPtr wp;
union { long l; Point pt; } hit;
printf("Picture MDEF Programmers Demo\nSelect Quit to finish\n\n");
/* shut up LSC */
Click_On(0);
/* get resources */
ph = (PicHandle)GetNamedResource('PICT', "\pDemo");
nh = (nrctHand)GetNamedResource('nrct', "\pDemo");
/* get menu */
mh = NewPicMenu((StringPtr)"\pPicture", ph, nh);
/* stuff in menu bar */
InsertMenu(mh, 0);
DrawMenuBar();
/* loop and print menu/item */
while(1)
{ if( GetNextEvent(-1, &event)/* && !StdEvent(&event)*/ )
{ if( FindWindow(event.where, &wp) == inMenuBar )
{ hit.l = MenuSelect(event.where);
printf("Menu: %d Item: %d\n", hit.pt.v, hit.pt.h);
/* tear off? */
if(hit.pt.h == -1)
printf("Palette Loc (%d,%d)\n",
(*(PicMenuHandle)mh)->tearLoc.v,
(*(PicMenuHandle)mh)->tearLoc.h);
/* Quit item, this is a SIMPLE demo! */
if(hit.l == 0x20006) break;
HiliteMenu(0);
}
}
}
ReleaseResource(ph);
ReleaseResource(nh);
DisposePicMenu(mh);
}